**********************************************************************************************
* Main run file to produce all results for Figures 3 to 8 and Appendix Figures A.5 to A.24
* 
* Note: In a second step run the Matlab Code RunAllFigures.m 
*       to produce the Figures as shown in the paper 
*       
* 
* Cloyne, Dimsdale and Hürtgen (2024) 								
*	"Are Tax Cuts Contractionary at the Zero Lower Bound? Evidence from a Century of Data"  	  		
*																			
* James Cloyne, Nicholas Dimsdale and Patrick Hürtgen, 2024
**********************************************************************************************

clear all
macro drop _all
pause off
set graphics on

global projectdir "CDHReplicationPackage"
							
cd "${projectdir}"
global dofilepath = "DoFiles"
global datapath = "MainData"

*------------------------------------------------------------------
* Prepare macro data
*------------------------------------------------------------------
do ${dofilepath}/Generic_MacroData.do 

*------------------------------------------------------------------
* Create Sample 
*------------------------------------------------------------------
global sample_start = "1920q1"   
global sample_end   = "2019q4"
  
*-------------------------------------------------------------------
* Output rootfolder
*-------------------------------------------------------------------
global rootfolder = "StataOutput/${shocksheet}"
capture mkdir ${rootfolder}
  
*-------------------------------------------------------------------
* Plot specification 
*-------------------------------------------------------------------
global PlotIRF = 1 
global saveFigs = 1

*-------------------------------------------------------------------
* Robustness checks and specification options
*-------------------------------------------------------------------
global hmax = 13             // IRF horizon
global spendControl = 1 	 // Include spending shock control post-2009
global spendControlVar X_SpendToGDP // Variable name for spending control
global ForceZLB = 4          // Define ZLB state such that we are still at the ZLB "ForceZLB" periods ahead
global RegimeDef = 1 	     // Standard = 1
global Unanticipated = 0	 // Unanticipated tax shocks = 1	
global noITC = 0			 // Excluding ITC tax shocks = 1	
global DropLargeShock = 0    // Drop specific large tax shocks 
global DropZLBRegime = 0     // Drop specific ZLB regimes
global gLeads = 0            // Control for future spending controls
global QEOutlier = 0         // Drop tax shocks that occured during QE
global skip_start = 1939     // skip period from the start of WWII
global skip_end = 1945       // end of WWII
global skipsample = 1 		 // skip WWII (1939-1945) or not 
global skip_harmonized = 0   // harmonize the sample before the skip_start year or not
global dummyWWII = 0		 // WWII indicator

*-------------------------------------------------------------------
* Prepare narrative shocks
*-------------------------------------------------------------------
global shockversion = "LRConsistent"
global shocksheet = "baseline" 

*-------------------------------------------------------------------
* Specification setup
*-------------------------------------------------------------------
global DataSetName = "MacroData_${shockversion}"  
global cfbandversion = "9068pctbands"   
do ${dofilepath}/CfbandSetup.do        
do ${dofilepath}/MacroData_${shockversion}Shocks.do
 
global Quiet 

*-------------------------------------------------------------------
* Main Figures 
*-------------------------------------------------------------------

* Figure 3
global figure = "Figure3"
do "${dofilepath}/Figure3.do"

* Figure 4 
global figure = "Figure4"
do "${dofilepath}/Figure4.do"

* Figure 5
global figure = "Figure5"
do "${dofilepath}/Figure5.do"

* Figure 6
global figure = "Figure6"
do "${dofilepath}/Figure6.do"

* Figure 7     
global figure = "Figure7"
do "${dofilepath}/Figure7.do"

* Figure 8a and A.16 (a)
global figure = "Figure8aand16a"
do "${dofilepath}/Figure8aand16a.do"

* Figure 8b and A.16 (b)  
global figure = "Figure8band16b"
do "${dofilepath}/Figure8band16b.do"

*-------------------------------------------------------------------
* Appendix Figures 
*-------------------------------------------------------------------

* Figure A.5
global figure = "FigureA5"
do "${dofilepath}/FigureA5.do"

* Figure A.6
global figure = "FigureA6"
do "${dofilepath}/FigureA6.do"

* Figure A.7
global figure = "FigureA7"
do "${dofilepath}/FigureA7.do"

* Figure A.8
global figure = "FigureA8"
do "${dofilepath}/FigureA8.do"

* Figure A.9
global figure = "FigureA9"
do "${dofilepath}/FigureA9.do"

* Figure A.10
global figure = "FigureA10"
do "${dofilepath}/FigureA10.do"

* Figure A.11
global figure = "FigureA11"
do "${dofilepath}/FigureA11.do"

* Figure A.12
global figure = "FigureA12"
do "${dofilepath}/FigureA12.do"

* Figure A.13
global figure = "FigureA13"
do "${dofilepath}/FigureA13.do"

* Figure A.14
global figure = "FigureA14"
do "${dofilepath}/FigureA14.do"

* Figure A.15a
global figure = "FigureA15a"
do "${dofilepath}/FigureA15a.do"

* Figure A.15b
global figure = "FigureA15b"
do "${dofilepath}/FigureA15b.do"	 

* Figure A.17
global figure = "FigureA17"
do "${dofilepath}/FigureA17.do"

* Figure A.18 and A.19
global figure = "FigureA18andA19"
do "${dofilepath}/FigureA18andA19.do"

* Figure A.20
global figure = "FigureA20"
do "${dofilepath}/FigureA20.do"

* Figure A.21
global figure = "FigureA21"
do "${dofilepath}/FigureA21.do"

* Figure A.22
global figure = "FigureA22"
do "${dofilepath}/FigureA22.do"

* Figure A.23 and A.24
global figure = "FigureA23andA24"
do "${dofilepath}/FigureA23andA24.do"

* Table 1
do "${dofilepath}/Table1.do"
